Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RPC protocol to Peer #394

Merged
merged 3 commits into from
Nov 18, 2022
Merged

Add RPC protocol to Peer #394

merged 3 commits into from
Nov 18, 2022

Conversation

akshayjshah
Copy link
Member

Currently, observability interceptors must parse the Content-Type
header to determine which RPC protocol is in use. This isn't awful, but
it's so easy for connect-go to expose directly that we might as well.

I chose to use our own strings rather than repurposing OpenTelemetry's
semantic conventions here. The OTel strings are less nice in this
context, and the packages are all unstable and subject to change.
@joshcarp, LMK if this seems like a bad tradeoff to you.

Currently, observability interceptors must parse the `Content-Type`
header to determine which RPC protocol is in use. This isn't awful, but
it's so easy for `connect-go` to expose directly that we might as well.

I chose to use our own strings rather than repurposing OpenTelemetry's
semantic conventions here. The OTel strings are less nice in this
context, and the packages are all unstable and subject to change.
@joshcarp, LMK if this seems like a bad tradeoff to you.
@akshayjshah akshayjshah requested a review from joshcarp November 15, 2022 21:09
Copy link
Contributor

@joshcarp joshcarp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it a lot

client_ext_test.go Outdated Show resolved Hide resolved
client_ext_test.go Outdated Show resolved Hide resolved
@mattrobenolt
Copy link
Contributor

So I actually already derived this on my own, so this is a nice addition I can use. Would it make sense to move it to it's own type/enum?

Something like:

type Protocol string

const (
    ProtocolConnect = Protocol("connect")
...
)

or whatever? Might make it easier to use for folks trying to consume this (like me).

@akshayjshah
Copy link
Member Author

Would it make sense to move it to it's own type/enum?

I'd rather not make a separate type, but I'm happy to do some enum-named constants!

From this codebase's perspective, I don't think named types are worth the API surface, since they don't stop us from mistakenly passing around string literals. I can see the utility of having them in code consuming these strings, but I'll leave that up to the consumer.

@mattrobenolt
Copy link
Contributor

I think a named constant would at least be useful. :)

Export constants for the three currently-supported protocols. This
commit also simplifies the implementation a bit: there's no need to make
the protocol name part of the internal `protocol` interface quite yet.
@akshayjshah akshayjshah merged commit 40a2428 into main Nov 18, 2022
@akshayjshah akshayjshah deleted the ajs/peer branch November 18, 2022 05:13
akshayjshah added a commit that referenced this pull request Jul 26, 2023
Currently, observability interceptors must parse the `Content-Type`
header to determine which RPC protocol is in use. This isn't awful, but
it's so easy for `connect-go` to expose directly that we might as well.

I chose to use our own strings rather than repurposing OpenTelemetry's
semantic conventions here. The OTel strings are less nice in this
context, and the packages are all unstable and subject to change.
@joshcarp, LMK if this seems like a bad tradeoff to you.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants